﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Brainee.Search;
using Brainee.Optimization;
using Brainee.Examples.Optimization;

namespace BrainUI
{
  public partial class Optimization : Form
  {
    public Optimization ()
    {
      InitializeComponent ();
    }

    private void button1_Click (object sender, EventArgs e)
    {
      EightQueens pb = new EightQueens ();
      pb.InitialState = new EightQueens.State ( 4, 5, 6, 3, 4, 5, 6, 5 );

      HillClimbingAlgorithm alg = new HillClimbingAlgorithm ();
      
      // 2 0 6 3 1 4 7 5
      //alg.Strategy = new SteepestAscentStrategy ();

      // 2 0 6 3 1 4 7 5
      alg.Strategy = new FirstChoiceHillClimbingStrategy ();

      OptimizationSolution solution = alg.Solve (pb);
    }

    private void button2_Click (object sender, EventArgs e)
    {
      EightQueens pb = new EightQueens ();
      pb.InitialState = new EightQueens.State (4, 5, 6, 3, 4, 5, 6, 5);

      SimulatedAnnealingAlgorithm alg = new SimulatedAnnealingAlgorithm ();
      alg.Schedule = (t => (t <= 100) ? 20 * Math.Exp (-0.045 * t) : 0);

      OptimizationSolution solution = alg.Solve (pb);
    }
  }
}
